Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional time window in TraceGetParameters #6159

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

rim99
Copy link

@rim99 rim99 commented Nov 4, 2024

Which problem is this PR solving?

Resolves #4150

Description of the changes

  • add optional time window when fetching trace by id

How was this change tested?

  • unittest

Checklist

@rim99 rim99 force-pushed the optinal-time-window-when-fetching-trace-by-id branch 2 times, most recently from 17bddcc to cb5f24f Compare November 4, 2024 13:34
@rim99 rim99 force-pushed the optinal-time-window-when-fetching-trace-by-id branch from cb5f24f to d00b4d3 Compare November 4, 2024 13:57
@rim99 rim99 marked this pull request as ready for review November 4, 2024 14:07
@rim99 rim99 requested a review from a team as a code owner November 4, 2024 14:07
@rim99 rim99 requested a review from jkowall November 4, 2024 14:07
@rim99 rim99 changed the title Add optinal time window in TraceGetParameters Add optional time window in TraceGetParameters Nov 4, 2024
@rim99 rim99 force-pushed the optinal-time-window-when-fetching-trace-by-id branch from a0bb411 to 74fd1e5 Compare November 10, 2024 11:55
@@ -49,15 +50,27 @@ func unwrapNotFoundErr(err error) error {
}

// QueryTrace queries for a trace and returns all spans inside it
func (q *Query) QueryTrace(traceID string) ([]model.Span, error) {
func (q *Query) QueryTrace(traceID string, startTime int64, endTime int64) ([]model.Span, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we always try to use strong types. Conversion from user-facing values can be done at the user interface layer, not at this internal API.

Suggested change
func (q *Query) QueryTrace(traceID string, startTime int64, endTime int64) ([]model.Span, error) {
func (q *Query) QueryTrace(traceID string, startTime time.Time, endTime time.Time) ([]model.Span, error) {

Comment on lines +56 to +57
StartTime *time.Time
EndTime *time.Time
Copy link
Member

@yurishkuro yurishkuro Nov 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

time.Time has IsZero that can be used as an indication of "value not provided", instead of pointers.

@@ -50,6 +50,13 @@ type Reader interface {
FindTraceIDs(ctx context.Context, query *TraceQueryParameters) ([]model.TraceID, error)
}

// TraceGetParameters contains parameters of a trace get.
type TraceGetParameters struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the name reads weird

Suggested change
type TraceGetParameters struct {
type GetTraceParameters struct {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: time parameters for querying trace by id
2 participants